feat: Use Docker's inspect API to get resource information #1018
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
The pull request replaces the list resource API calls with the inspect API call.
Why is it important?
This simplifies the internal Testcontainers' API. In addition, it reduces the number of operations and might result in slight performance improvements. Furthermore, the pull image policy callback will contain additional information to determine whether Testcontainers should pull an image or not.
The container and image builder members
WithImagePullPolicy
andWithImageBuildPolicy
received a callback argument of typeImagesListResponse
. We updated these callbacks, they will now receive an argument of typeImageInspectResponse
. This change has been made to provide more detailed information about the actual cached image.Related issues
-
Follow-ups
Testcontainers currently pre-pulls images before building an image from a Dockerfile. Right now, Testcontainers always attempts to pull base images, even if they already exist on the Docker host. After this pull request, we will be able to skip pre-pulling images for those that already exist locally.